<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>变量运算</title>
    <script>
        function f1() {
            let num1 = 3;
            let num2 = 2;
            console.log(num1 + " + " + num2 + " = " + (num1 + num2))
            console.log(num1 + " - " + num2 + " = " + (num1 - num2))
            console.log(num1 + " * " + num2 + " = " + (num1 * num2))
            console.log(num1 + " / " + num2 + " = " + (num1 / num2))
            console.log(num1 + " % " + num2 + " = " + (num1 % num2))
            console.log(num1++);
            console.log(++num2);
            console.log(num1 > 0);
            console.log(num1 < 0);
            console.log(num1 > 0 && num1 < 0);
            console.log(num1 > 0 || num1 < 0);
            console.log(num1 == num2 ? "等于" : "不等于");
        }

        function f2(){
            // 由于js是一个弱类型的语言
            // 在进行比较时,只比较值的大小,不关心其类型
            console.log(1 == "1");
            // 但是,在某些特殊场景,可能需要对其类型也进行比较
            // 可以使用恒等于进行比较,===
            console.log(1 === "1");
            console.log(1 === 1);
        }

        function f3(){
            console.log(200**3);
            console.log(200**0);
            console.log((-2)**4);
        }
    </script>
</head>
<body>
<button onclick="f1()">基本运算</button><br>
<button onclick="f2()">恒等于</button><br>
<button onclick="f3()">模方</button>
</body>
</html>